home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_aet_rotatesophia.cog < prev    next >
Text File  |  1999-11-15  |  3KB  |  130 lines

  1. # Jones 3D Cog Script
  2. #
  3. # aet_RotateSophia.cog
  4. #
  5. # Rotate Sophia inside the cage
  6. #
  7. # [HB] [TL]
  8. #
  9. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  10. #
  11. # ==============================================================================
  12.  
  13. symbols
  14.  
  15. # .................................. MESSAGES ..................................
  16.  
  17.     message        user0
  18.     message        user1
  19.     
  20. # ................................. KEYFRAMES ..................................
  21.  
  22.     keyframe    so_wobble=0so_spin.key                    local
  23.  
  24. # ................................ ACTOR THINGS ................................
  25.  
  26.     thing        sophia                                    nolink
  27.  
  28. # ............................... OBJECT THINGS ................................
  29.  
  30.     thing        spin_tgt_1                                nolink
  31.     thing        spin_tgt_2                                nolink
  32.     thing        spin_tgt_3                                nolink
  33.  
  34. # ............................... VARIABLES ....................................
  35.     
  36.     vector        v_spos                                    local
  37.     vector        v_tpos                                    local
  38.     vector        v_aim                                    local
  39.  
  40.     flex        f_X                                        local
  41.     flex        f_Y                                        local
  42.  
  43.     int            shespins=0                                local
  44.     
  45. end
  46.  
  47. # ==============================================================================
  48.  
  49. code
  50.  
  51. # NOTE ON COG BEHAVIOR:
  52. # User1 starts Sophia spinning
  53. #
  54. # User0 zeroes our heroine
  55. #
  56. # All spinning is clockwise viewed from above,
  57. # moving sophia's look to ghost targets spaced 120 degrees apart
  58.  
  59. # ..............................................................................
  60.  
  61. user0:
  62.  
  63.     shespins = 0;
  64.     
  65.     # Get rid of Sophia...
  66.     ThingFadeAnim(sophia, 1.0, 0.0, 0.5, 0);
  67.     Sleep(0.5);
  68.     ResetThing(sophia);
  69.     DestroyThing(sophia);
  70.  
  71.     return;
  72.  
  73. # ..............................................................................
  74.  
  75. user1:
  76.     
  77.     AISetCutsceneMode(sophia);                # TL - Added for Sophia actor.
  78.     ClearThingFlags(sophia, 0x80000);        # TL - Added for Sophia actor.
  79.     shespins = 1;
  80.     
  81.     # Aim Sophia...
  82.     v_tpos = GetThingPos(spin_tgt_3);
  83.     v_spos = GetThingPos(sophia);
  84.     v_aim = VectorNorm(VectorSub(v_tpos, v_spos));
  85.     f_X = VectorX(v_aim);
  86.     f_Y = VectorY(v_aim);
  87.     v_aim = VectorSet(f_X, f_Y, 0.0); # remove Z        
  88.     SetThingLook(sophia, v_aim);
  89.  
  90.     # Prevent looking up and down...
  91.     SetThingMaxHeadPitch(sophia, 0.0);
  92.     SetThingMinHeadPitch(sophia, 0.0);
  93.     
  94.     # Rotate at magic rate...
  95.     SetThingMaxHeadVel(sophia, 36.0); # no head jerks to next mark
  96.     SetThingMaxRotVel(sophia, 36.0); # 12 secs to spin 360
  97.  
  98.     # Play swim anim...
  99.     PlayKey(sophia, so_wobble, 6, 0x10, 0);
  100.     
  101.     while (shespins != 0)
  102.     {
  103.         AISetLookThingEyeLevel(sophia, spin_tgt_1);
  104.         if (shespins != 0)
  105.         {
  106.             AIWaitForStop(sophia);
  107.         }
  108.         if (shespins != 0)
  109.         {
  110.             AISetLookThingEyeLevel(sophia, spin_tgt_2);
  111.         }
  112.         if (shespins != 0)
  113.         {
  114.             AIWaitForStop(sophia);
  115.         }
  116.         if (shespins != 0)
  117.         {
  118.             AISetLookThingEyeLevel(sophia, spin_tgt_3);
  119.         }
  120.         if (shespins != 0)
  121.         {
  122.             AIWaitForStop(sophia);
  123.         }
  124.     }
  125.  
  126.     return;
  127.  
  128. end
  129.